package com.gwtplatform.samples.nested.client.main;

import com.google.inject.Inject;

import com.guit.client.GuitPresenter;
import com.guit.client.View;
import com.guit.client.binder.GuitBinder;
import com.guit.client.binder.ViewField;
import com.gwtplatform.samples.nested.client.attacher.RootPanelAttacher;
import com.gwtplatform.samples.nested.client.main.MainPresenterImpl.MainPageBinder;

public class MainPresenterImpl extends GuitPresenter<MainPageBinder> implements MainPresenter {
    
    public static interface MainPageBinder extends GuitBinder<MainPresenterImpl> {
    }

    private final RootPanelAttacher attacher;
    
    @ViewField
    HasWidget panel;
    
    @Inject
    public MainPresenterImpl(RootPanelAttacher attacher) {
        this.attacher = attacher;
    }
    
    @Override
    protected void initialize() {
        attacher.attach(getView());
    }
    
    @Override
    public void setContent(View content) {
        panel.setWidget(content);
    }
}
